/* Copyright (c) 2025 Beijing Semidrive Technology Corporation
 * SPDX-License-Identifier: Apache-2.0
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
/** *****************************************************************************************************
 * \file     Uart_Cfg.c                                                                                 *
 * \brief    AUTOSAR 4.3.1 MCAL UART Driver                                                             *
 *                                                                                                      *
 * <table>                                                                                              *
 * <tr><th>Date           <th>Version                                                                   *
 * <tr><td>2024/10/29     <td>1.0.0                                                                     *
 * </table>                                                                                             *
 *******************************************************************************************************/

#ifdef __cplusplus
extern "C" {
#endif

/********************************************************************************************************
 *                                      Include header files                                            *
 *******************************************************************************************************/
#include "Uart_Cfg.h"
#include "Uart_Types.h"
#include "__regs_base.h"

/********************************************************************************************************
 *                                  Global Function Declarations                                        *
 *******************************************************************************************************/
extern void uart_rx_handle(uint8 channel, uint8 * data, uint8 len);


/********************************************************************************************************
 *                                  Private Variable Definitions                                        *
 *******************************************************************************************************/

#define UART_START_SEC_CONFIG_DATA_UNSPECIFIED
#include "Uart_MemMap.h"

static const Uart_ChannelConfigType Uart_ChannelConfig[UART_CHANNEL_MAX] =
{
    /* Channel ID 0 */
    {
        .baseAddr = APB_UART15_BASE,
        .baudRate = 115200U,
        .dataBit = UART_DATA_BIT_8BIT,
        .stopBits = UART_STOP_BIT_1BIT,
        .parity = UART_PARITY_TYPE_DISABLE,
        .addrBit = FALSE,
        .sampleRate = UART_SAMPLERATE_16X,
        .autoBaud = FALSE,
        .matchNum = UART_MATCH_NUM_1,
        .txwmlvl = 0U,
        .rxwmlvl = 0U,
        .duplexMode = UART_MODE_FULL_DUPLEX,
        .dataFill = 0U,
        .assignCoreId = 0U,
        .callBack = NULL_PTR,
        .realTimeRxCallBack = uart_rx_handle,
    },

};

/********************************************************************************************************
 *                                  Global Variable Declarations                                        *
 *******************************************************************************************************/
const Uart_ConfigType Uart_Config =
{
    .channelConfigs = &Uart_ChannelConfig[0U],
};

#define UART_STOP_SEC_CONFIG_DATA_UNSPECIFIED
#include "Uart_MemMap.h"

#ifdef __cplusplus
}
#endif

/* End of file */
